<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="author" content="Guillaume Laborde - Guillaume Lameyre" />
<link rel="stylesheet" media="screen" type="text/css" title="style" href="css/style.css" />
<title>ContactBook</title>
</head>

<body>

	<c:set var="account" value="${sessionScope.account}" />
	<c:set var="message" value="${requestScope.message}" />
	<jsp:useBean id="contact" class="contactbook.model.Contact" scope="request" />
	
	<c:if test="${empty account}">
		<c:redirect url="Index" />
	</c:if>

	<div id="mainframe">
		<c:import url="include/privateBanner.html" />
		<h1>Supprimer un contact</h1>
		<div id="content">
		
			<c:if test="${empty message}">
				<form action="DeleteContact" method="POST" class="form">
					<table>
						<tr><td>Etes-vous sûr de vouloir supprimer "<jsp:getProperty name="contact" property="firstName" /> <jsp:getProperty name="contact" property="lastName" />" ?</td></tr>
						<tr><td class="button"><input type="submit" name="submit" value="Oui" /> <input type="submit" name="submit" value="Non" /></td></tr>
					</table>
					<input type="hidden" name="contactId" value="<jsp:getProperty name="contact" property="id" />" />
				</form>
			</c:if>
			
			<c:if test="${message == 'CONTACT_DELETED_OK'}">
				<form action="Contact" method="POST" class="form">
					<table>
						<tr><td><jsp:getProperty name="contact" property="firstName" /> <jsp:getProperty name="contact" property="lastName" /> a été correctement supprimé de la liste des contacts.</td></tr>
						<tr><td class="button"><input type="image" src="images/back.png" alt="Retour" /></td></tr>
					</table>
				</form>
			</c:if>
			
			<c:if test="${message == 'CONTACT_DELETED_FAIL'}">
				<form action="Contact" method="POST" class="form">
					<table>
						<tr><td>La suppression du groupe a échoué.</td></tr>
						<tr><td class="button"><input type="image" src="images/back.png" alt="Retour" /></td></tr>
					</table>
				</form>
			</c:if>
		</div>
		<c:import url="include/bottom.html" />
	</div>
	
</body>
</html>